package com.dogborther.pojo;

import com.dogborther.utils.ChopstickStatus;
import com.dogborther.utils.PhilosopherStatus;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import lombok.Data;

import java.net.URL;
import java.util.Random;
@Data
public abstract class Philosopher {
    private int id;

    private Button button;

    private ImageView imageView;
    private ImageView leftHandChopstick;
    private ImageView rightHandChopstick;

    private Chopstick leftChopstick;
    private Chopstick rightChopstick;
    public static Integer selectMode;
    public static boolean stop = true;

    public void setImage(PhilosopherStatus philosopherStatus){

    }

    public void run(){

    }

    public void think() {
        this.setImage(PhilosopherStatus.THINKING);
        try {
            Thread.sleep(new Random().nextInt(4000)+1500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    public void eat(){

    }
    public void hungry(){
    }
    public void takeChopstickFromLeftToRight(){

    }
    public void takeChopstickFromRightToLeft(){

    }
    private synchronized void dropDownChopsticks() {

    }
    public static void setSelectMode(Integer selectMode) {
        Mode0Philosopher.selectMode = selectMode;
    }
    public static void setStop(boolean stop){
        Mode0Philosopher.stop = stop;
    }

    public abstract void setId(int i);
}
